package com.kgis.map.task.analysis
{
   import com.kgis.map.Map;
   import com.kgis.map.feature.Feature;
   import com.kgis.map.geometry.*;
   import com.kgis.map.geometry.basetype.Extent;
   import com.kgis.map.layer.FeatureLayer;
   import com.kgis.map.layer.LayerData;

   import mx.rpc.events.FaultEvent;
   import com.kgis.map.task.analysis.IAnalysis;

   /**
    * 查询
    * 通过远程调用查询
    */
   public class SpatialAnalysis implements IAnalysis {
      protected var operationName:String;
      public var onResult:Function = null;
      public var onFault:Function = null;

      public function SpatialAnalysis(operationName:String) {
         this.operationName = operationName;
         //不加这几句，类型反射会有问题，部分类型识别不出来
         var tmp:Object = null;
         tmp is AreaComposeGeometry;
         tmp is PolylineGeometry;
         tmp is PolygonGeometry;
         tmp is PointGeometry;
         tmp is ArcGeometry;
         tmp is CircleGeometry;
         tmp is EllipseGeometry;
         tmp is LineComposeGeometry;
      }

      /**
       * @param onResult 远程调用执行成功的回调函数
       * @param onFault 远程调用执行失败的回调函数
       */
      public function execute():void {
         return;
      }

      protected function onAnalysisFault(event:FaultEvent, token:Object = null):void {
         trace(event.fault.message);
         if (onFault != null) {
            onFault(event.fault.message, token);
         }
      }

   }
}